#include<iostream>
#include<cstdio>
#define I using
#define love namespace
#define SSL std;
I love SSL;

int n,tot;
int a[200010];
int v[200010];

int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	int s=0;
	while(s<n)
	{
		int last=0;
		for(int i=1;i<=n;i++)
		{
			if(v[i]) continue;
			printf("%d ",i);
			v[i]=1;
			s++;
			int j=i+1;
			while(a[j]==a[i]&&j<=n) j++;
			i=j;
		}
		cout<<endl;
	}
}
